package com.zzw.bridge.business.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzw.bridge.business.dto.NoPassReportDTO;
import com.zzw.bridge.business.dto.ReportQueryDTO;
import com.zzw.bridge.business.dto.ReportStatisticDTO;
import com.zzw.bridge.business.dto.ZzwPierColumnReportDTO;
import com.zzw.bridge.business.service.ZzwPierColumnReportService;
import com.zzw.bridge.business.vo.ReportStatisticVo;
import com.zzw.bridge.business.vo.ZzwPierColumnReportHisVo;
import com.zzw.bridge.business.vo.ZzwPierColumnReportInfoVo;
import com.zzw.bridge.business.vo.ZzwPierColumnReportVo;
import com.zzw.bridge.common.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * 墩柱报告信息表
 *
 * @author XiaoJie
 * @date 2025-05-22 10:32:24
 */
@Tag(name = "报告控制器")
@RestController
@RequestMapping("business/report")
public class ZzwPierColumnReportController {

    @Resource
    private ZzwPierColumnReportService reportService;

    @PostMapping("/editProject")
    @Operation(summary = "编辑")
    public Result<String> editProject (@RequestBody ZzwPierColumnReportDTO dto) {
        return Result.ok(reportService.editProject(dto));
    }

    @PostMapping("/queryReportInfo/{reportId}")
    @Operation(summary = "详情")
    public Result<ZzwPierColumnReportInfoVo> queryReportInfo (@PathVariable("reportId") String reportId) {
        return Result.ok(reportService.queryReportInfo(reportId));
    }

    @PostMapping("/queryHisPage")
    @Operation(summary = "查历史报告")
    public Result<Page<ZzwPierColumnReportHisVo>> queryHisPage (@RequestBody @Validated ReportQueryDTO dto) {
        return Result.ok(reportService.queryHisPage(dto));
    }

    @PostMapping("/reportStatistics")
    @Operation(summary = "报告统计")
    public Result<ReportStatisticVo> reportStatistics (@RequestBody @Validated ReportStatisticDTO dto, HttpServletRequest request) {
        return Result.ok(reportService.reportStatistics(dto,request));
    }

    @PostMapping("/queryPage")
    @Operation(summary = "点击不合格展示列表")
    public Result<Page<ZzwPierColumnReportVo>> queryNoPassReportPage (@RequestBody @Validated NoPassReportDTO dto, HttpServletRequest request) {
        return Result.ok(reportService.queryNoPassReportPage(dto,request));
    }

    @PostMapping("/delete/{reportId}")
    @Operation(summary = "删除")
    public Result<String> delete (@PathVariable("reportId") String reportId) {
        return Result.ok(reportService.delete(reportId));
    }
}
